package dao

import (
	"github.com/cuiyuanxin/airuisi-admin/internal/model"
)

func (d *Dao) CountTag(name string, state uint8) (int, error) {
	role := model.Role{}
	return role.Count(d.Repository.Db)
}

func (d *Dao) GetTagList(name string, state uint8, page, pageSize int) ([]*model.Role, error) {
	role := model.Role{}
	return role.List(d.Repository.Db, 1, pageSize)
}

func (d *Dao) CreateTag(name string, state uint8, createdBy string) error {
	role := model.Role{}

	return role.Create(d.Repository.Db)
}

func (d *Dao) UpdateTag(id uint32, name string, state uint8, modifiedBy string) error {
	role := model.Role{}

	return role.Update(d.Repository.Db)
}

func (d *Dao) DeleteTag(id uint32) error {
	role := model.Role{}
	return role.Delete(d.Repository.Db)
}
